package com.example.qt.ptplatform.controller;

import com.example.qt.ptplatform.entity.PointRecord;
import com.example.qt.ptplatform.service.PointRecordService;
import com.example.qt.ptplatform.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/points")
public class PointController {

    @Autowired
    private PointRecordService pointRecordService;

    /**
     * 获取某个用户的保种积分明细（积分类型为 keepSeed）
     * @param userId 用户ID
     */
    @GetMapping("/keepSeedRecords")
    public JsonResult getKeepSeedPoints(@RequestParam("userId") Integer userId) {
        List<PointRecord> records = pointRecordService.getKeepSeedRecordsByUserId(userId);
        return JsonResult.success(200, "查询成功", records);
    }
}
